Skip to content

Conversation

@konard
Copy link
Member

@konard konard commented Sep 12, 2025

Summary

  • Added template function NextUInt<T> that works with uint8_t, uint16_t, uint32_t, and uint64_t
  • Added overload for NextUInt<T> with range parameter for constrained random generation
  • Maintained backward compatibility with existing NextUInt64 functions by implementing them using the new templates
  • Added comprehensive tests for all template instantiations and range constraints

Implementation Details

The implementation includes:

  • Template parameter constraints using static_assert to ensure only unsigned integer types are used
  • Compile-time dispatch to appropriate range constants (UInt8, UInt16, UInt32, UInt64)
  • Full backward compatibility - existing NextUInt64 functions now delegate to the templated versions
  • Comprehensive test coverage for all supported unsigned integer types

Test plan

  • Syntax validation passes with GCC
  • Added unit tests for all template instantiations (uint8_t, uint16_t, uint32_t, uint64_t)
  • Added tests for range-constrained generation
  • Verified backward compatibility with existing NextUInt64 functions
  • All tests follow existing testing patterns in the codebase

🤖 Generated with Claude Code


Resolves #54

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #54
@konard konard self-assigned this Sep 12, 2025
- Added template function NextUInt<T> that works with uint8_t, uint16_t, uint32_t, and uint64_t
- Added overload for NextUInt<T> with range parameter
- Maintained backward compatibility with existing NextUInt64 functions
- Added comprehensive tests for the new templated functions
- Added type_traits include for template constraints

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@konard konard changed the title [WIP] Add template to NexUInt Add templated NextUInt function for generic unsigned integer types Sep 12, 2025
@konard konard marked this pull request as ready for review September 12, 2025 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add template to NexUInt

2 participants